package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.CutTimeBean;
import com.lwj.liwanjia.impl.CutTimeView;
import com.lwj.liwanjia.model.CutTimeModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/9/10.
 */

public class CutTimePresenter {
    private CutTimeModel cutTimeModel;
    private CutTimeView cutTimeView;

    public CutTimePresenter(CutTimeView cutTimeView) {
        this.cutTimeView = cutTimeView;
        cutTimeModel = new CutTimeModel();
    }

    public void getCutTimeData() {
        if (cutTimeView != null) {
            cutTimeModel.getCutTimeData( new Subscriber<CutTimeBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    cutTimeView.showError((Exception) e);
                }

                @Override
                public void onNext(CutTimeBean cutTimeBean) {
                    cutTimeView.getCutTimeData(cutTimeBean);
                }
            });
        }
    }
}
